// 模式匹配练习

#[derive(Debug)]
struct Point{
    x: i32,
    y: i32,
}

fn main() {

    // @ 绑定 + 解构
    let p @ Point{x: px, y: py} = Point { x: 123, y: 345 };
    println!("Point: x = {}, y = {}", px, py);
    println!("{:?}", p);

    let pt = Point{x: 10, y: 20};
    if let p @ Point{x: 10, y} = pt {
        println!("Point.x = 10, point.y = {}， in {:?}", y, p);
    } else {
        println!("p.x != 10");
    }
}